home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / programming / arexx / rexxbgui / bguishowdir.awebrx < prev    next >
Text File  |  1999-06-14  |  2KB  |  88 lines

  1. /* REXX */
  2.  
  3. 'GET SCREEN VAR scr'
  4. 'GET SELECTION VAR sel'
  5. IF rc>0 THEN sel=''
  6. sel=strip(sel)
  7. dir='Work:TEMP/'sel
  8. if right(dir,1)~='/' & right(dir,1)~=':' then dir=dir'/'; else nop
  9. address command 'list >t:list' dir 'LFORMAT "%N    %L    %D"'
  10. address command 'sort t:list t:list2'
  11.  
  12. if ~show('l','rexxbgui.library') then do
  13.     if ~addlib('rexxbgui.library',0,-30) then do
  14.         exit(20)
  15.     end
  16.     else nop
  17. end
  18. else nop
  19.  
  20. call bguiopen('AWebShowDir')
  21.  
  22. call bguireadentries('t:list2','LST')
  23.  
  24. address command 'delete >NIL: t:list t:list2'
  25.  
  26. signal on syntax /* important: bguiclose() MUST be called */
  27. signal on halt
  28. signal on break_c
  29.  
  30. esc='1B'x
  31. lf='0A'x
  32. cr='0D'x
  33. tab='09'x
  34. grspace.narrow=-1
  35. grspace.normal=-2
  36. grspace.wide=-3
  37.  
  38. g=bguivgroup(,
  39.     bguilistview('listv',,'LST','S',3 90 20 20)||,
  40.     bguihgroup(,
  41.         bguibutton('del','_Delete')||,
  42.         bguivarspace(50)||,
  43.         bguibutton('quit','_Quit'),
  44.     )||bguilayout(LGO_FixMinHeight,1),
  45. ,grspace.normal,grspace.normal)
  46.  
  47. call bguiset(obj.del,,GA_Disabled,1)
  48.  
  49. a=bguiwindow('Directory "'sel'" locally ('dir')',g,55,80,,scr)
  50.  
  51. if bguiwinopen(a)=0 then bguierror(12) else nop
  52.  
  53. id=0
  54. do while bguiwinwaitevent(a,'ID')~=id.winclose
  55.     select
  56.         when id=id.listv then call bguiset(obj.del,a,GA_Disabled,0)
  57.         when id=id.del then do
  58.             parse value bguiget(obj.listv,LISTV_LastClicked) with,
  59.                 file (tab) /* bug fixed */
  60.             fname=dir||file
  61.             if bguireq('Delete' fname'?','*_Yes|_No',,a)=1 then do
  62.                 address command 'delete >nil:' fname
  63.                 if rc=0 then do
  64.                     call bguilistvcommand(obj.listv,a,'remselected')
  65.                 end; else do
  66.                     call bguireq('Unable to delete!','*_OK',,a)
  67.                 end
  68.             end; else nop
  69.         end
  70.         when id=id.quit then leave
  71.         when id=id.winclose then nop
  72.         otherwise nop
  73.     end
  74. end
  75. rc=0
  76.  
  77. syntax:
  78. if rc~=0 then address aweb.1 'request Error "' '+++ ['rc']' errortext(rc) 'at line' sigl '" "_Abort"'
  79. call bguiclose()
  80. exit 10
  81.  
  82. break_c:
  83. halt:
  84. rc=0
  85. address aweb.1 'request Error "' '+++ Break at line' sigl '" "_Abort"'
  86. call bguiclose()
  87. exit 10
  88.